package admrouter

import (
	"github.com/gin-gonic/gin"
	"yundian/internel/app/handlers/pcl/admin/kaprojecthandler"
	"yundian/internel/app/handlers/pcl/admin/screencharthandler"
	"yundian/internel/app/handlers/pcl/admin/statisticalhandler"
	"yundian/internel/app/middlewares"
	"yundian/internel/pkg/dingo"
)

func InitStatisticalRouter() dingo.ApiRouter {

	return func(g *gin.RouterGroup) {
		{
			s := g.Group("statistical")
			s.POST("screen/get-day-info", screencharthandler.HandleGetStatisticsInfo)           // 查询统计数据
			s.POST("screen/get-order-list", screencharthandler.HandleGetOrderList)              // 查询最新订单
			s.POST("screen/get-pay-month", screencharthandler.HandleGetPayMonth)                // 总流水月统计
			s.POST("screen/get-places-type-ratio", screencharthandler.HandleGetPlacesTypeRatio) // KA门店占比统计
			s.POST("screen/get-places-info", screencharthandler.HandleGetPlacesInfo)            // 查询网点设备数据
			s.POST("screen/get-places-geography", screencharthandler.HandleGetPlacesGeography)  // 门店地理分布查询
			g.POST("get-all-project", kaprojecthandler.HandleGetAllProjectList)                 // 查询项目/KA名称

			s.Use(middlewares.JwtAuthMiddleware)

			// 经营概况统计
			s.POST("/manage/summary", statisticalhandler.ManageSummaryStatisticalList)
			s.POST("/manage/summary-type", statisticalhandler.ManageSummaryStatisticalTypeList)

			// 代理统计报表
			s.GET("/agent", statisticalhandler.AgentStatisticalList) // 代理统计报表

			s.GET("/place", statisticalhandler.PlaceStatisticalList) // 网点统计报表

			s.GET("/device", statisticalhandler.DeviceStatisticalList) //设备统计报表

			s.GET("/placeQuery", statisticalhandler.PlaceAccountCheckingList) //网点对账单

			s.GET("/project", statisticalhandler.ProjectStatisticalList) //项目营业统计

			s.GET("/monthStatistical", statisticalhandler.MonthStatisticalList) //月运营统计

			s.GET("/projectUser", statisticalhandler.ProjectUserManagementList) //项目代理管理

			s.GET("/projectPlace", statisticalhandler.ProjectPlaceManagementList) //项目网点管理

			s.GET("/projectOrder", statisticalhandler.ProjectOrderManagementList) //项目订单管理

			s.GET("/searchUserType", statisticalhandler.SearchUserTypeList) //查询用户

			s.GET("/searchPlaceType", statisticalhandler.SearchPlaceTypeList) //查询网点信息

			s.GET("/searchDeviceType", statisticalhandler.SearchDeviceTypeList) //查询设备类型

			s.GET("/regionsParentList", statisticalhandler.GetRegionsParentList) //查询市

			s.GET("/regionsList", statisticalhandler.GetRegionsList) //查询省

			//---------统计重构
			//代理商统计
			s.GET("/agentIncomeList", statisticalhandler.AgentIncomeList)
			//分公司统计
			s.GET("/branchIncomeList", statisticalhandler.BranchIncomeList)
			//网点对账单
			s.GET("/ordersStatistics", statisticalhandler.OrdersStatisticsList)
			//网点统计
			s.GET("/placeStatistics", statisticalhandler.PlaceStatisticsList)
			//用户分红明细
			s.GET("/dividendsList", statisticalhandler.DividendsList)
			//手动统计
			s.GET("/manual", statisticalhandler.ManualReport)
			//项目统计
			s.GET("/projectStatistics", statisticalhandler.ProjectStatisticsList)

			s.GET("/internalStatistics", statisticalhandler.InternalStatisticsList)

			// 2022-02-22
			// ------------------------ 新统计 API --------------------------------------- //

			// 基础数据
			s.GET("/get-analysis-normal", statisticalhandler.HandleGetAnalysisNormal) // 获取分析数据
			s.GET("/get-analysis", statisticalhandler.HandleGetAnalysis)              // 获取分析数据
			s.GET("/get-analysis-list", statisticalhandler.HandleGetAnalysisList)     // 获取数据列表
			s.POST("/order-basic", statisticalhandler.HandleOrderBasicStatistics)     // 手动更新基础数据
			s.PUT("/edit-uv-data", statisticalhandler.HandleUpdateUvData)             // UV 数据录入
			s.GET("/export-data", statisticalhandler.HandelBasicAnalysisExport)       // 基础数据导出

			// 代理用户
			s.GET("/get-analysis-user-list", statisticalhandler.HandleGetAnalysisListByUser)  // 获取代理商用户 分析数据
			s.GET("/get-team-ranklist", statisticalhandler.HandleGetTeamRankList)             // 团队数排行
			s.GET("/get-place-ranklist", statisticalhandler.HandleGetPlaceRankList)           // 门店数排行
			s.GET("/get-settlement-ranklist", statisticalhandler.HandleGetSettlementRankList) // 流水排行
			s.GET("/get-income-ranklist", statisticalhandler.HandleGetIncomeRankList)         // 收益排行
			s.POST("/update-statistics-user", statisticalhandler.HandleOrderStatisticsByUser) // 手动更新
			s.GET("/export-statistics-user", statisticalhandler.HandelAnalysisUserExport)     // 导出

			// 扫码
			s.GET("/scan-logs", statisticalhandler.HandleGetScanLogs)

		}
	}

}
